<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>生成查验记录</title>
    <link rel="stylesheet" href="../assets/plugin/multiSelect/css/multiselect.css"/>
    <link rel="stylesheet" href="../assets/plugin/jquery-ui-1.12.1.custom/jquery-ui.css"/>
    <link rel="stylesheet" href="../assets/plugin/layer/skin/default/layer.css"/>
    <style type="text/css">
        .container-section {
            width: 90%;
            margin-left: auto;
            margin-right: auto;
            letter-spacing: 1px;
            font-size: 14px;
            font-family: Arial, 'Microsoft YaHei';
        }

        .main-section {
            border-radius: 5px;
            border: 1px solid #ddd;
        }

        .header-section {
            height: 52px;
            line-height: 52px;
            text-align: center;
            font-size: 16px;
            border-bottom: 1px solid #e7e7e7;
            background-color: #d1e1f5;
        }

        /* .content-section,.cabinet-section,.checkRecore-section{
            padding:8px 10px;
            border-bottom:1px solid #e7e7e7;
        } */
        .content-section, .cabinet-section {
            padding: 8px 10px;
            border-bottom: 1px solid #e7e7e7;
        }

        .content-section table {
            width: 100%;
        }

        .cabinet-name {
            width: 20%;
            float: left;
        }

        .cabinet-name tr {
            height: 30px;
            line-height: 30px;
        }

        .td-label {
            width: 4%;
            text-align: right;
        }

        .td-content {
            width: 20%;
        }

        .cabinet-label {
            width: 34%;
            text-align: right;
        }

        .cabinet-content {
            width: 49%;
        }

        .cabinet-link {
            width: 80%;
            float: left;
        }

        .cabinet-link tr {
            height: 30px;
            line-height: 30px;
        }

        /* .cabinet-link td{
            width:20%;
        } */
        .clean {
            clear: both;
        }

        .label-bold {
            font-weight: bold;
        }

        /* .checkRecore-section{
            background-color:#daeffb;
        } */
        .checkRecore-section-default {
            background-color: #daeffb;
        }

        .checkRecore-section table {
            width: 100%;
        }

        .checkRecore-section tr {
            height: 30px;
            line-height: 30px;
        }

        .checkRecore-label {
            width: 8%;
            text-align: right;
        }

        .checkRecore-content {

        }

        .checkRecore-section tfoot td {
            text-align: center;
            height: 60px;
        }

        .checkRecore-section tfoot span {
            margin-left: 60px;
        }

        .btn-section {
            text-align: center;
            padding: 20px;
        }

        .btn {
            color: #fff;
            width: 120px;
            height: 32px;
            border: 0px;
            border-radius: 5px;
            margin-right: 80px;
            font-family: Arial, 'Microsoft YaHei';
        }

        .btn-blue {
            background-color: #1985d8;
        }

        .checkRecore-section-contact {
            margin-top: 10px;
        }

        .checkRecord-table-template {
            display: none;
        }

        .contact-wrap {
            padding: 8px 10px;
            margin-bottom: 10px;
            background-color: #daeffb;
            border-bottom: 1px solid #e7e7e7;
        }

        .check-depts-select {
            float: left;
        }

        .checkDepts-input-container {
            float: left;
            display: none;
        }

        .check-items-select {
            float: left;
        }

        .checkItems-input-container {
            float: left;
            display: none;
        }
    </style>
</head>
<body>
<div class="container-section">
    <div class="main-section">
        <div class="header-section">
            生成查验记录
        </div>
        <form class="form-horizontal">
            <div class="content-section">
                <table>
                    <tbody>
                    <tr>
                        <td class="td-label">业务编号：</td>
                        <td class="td-content check-bussinessNo"><!--BE201706160055--></td>
                        <td class="td-label">收发货人：</td>
                        <td class="td-content check-owner"><!--北京江洲国际贸易有限公司--></td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="cabinet-section">
                <table class="cabinet-name">
                    <tbody>
                    <tr>
                        <td class="cabinet-label label-bold">拼单业务编号</td>
                        <td class="cabinet-content">&nbsp;</td>
                    </tr>
                    <!-- <tr>
                        <td class="cabinet-label">柜号：</td>
                        <td class="cabinet-content"><input type="checkbox" value="BE201706160055"/>BE201706160055</td>
                    </tr>
                    <tr>
                        <td class="cabinet-label">&nbsp;</td>
                        <td class="cabinet-content"><input type="checkbox" value="AE201706160055"/>AE201706160055</td>
                    </tr> -->
                    </tbody>
                </table>
                <table class="cabinet-link">
                    <thead>
                    <tr>
                        <!-- <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td> -->
                    </tr>
                    </thead>
                    <tbody>
                    <!-- <tr>
                        <td><input type="checkbox" value="AD201706160010"/>AD201706160010+广东金意陶瓷有限公司</td>
                        <td><input type="checkbox" value="AD201706160011"/>AD201706160011+广东金意陶瓷有限公司</td>
                        <td><input type="checkbox" value="AD201706160012"/>AD201706160012+广东金意陶瓷有限公司</td>
                    </tr>
                    <tr>
                        <td><input type="checkbox" value="AD201706160013"/>QW201706160055+深圳市钱峰进出口有限公司</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr> -->
                    </tbody>
                </table>
                <div class="clean"></div>
            </div>
            <div class="checkRecore-section checkRecore-section-default">
                <table class="checkRecord-table checkRecord-table-template">
                    <thead>
                    <tr>
                        <td class="checkRecore-label label-bold check-sequence"><span
                                class="check-sequence-span">查验记录1</span><input type="hidden"
                                                                               value=""></td>
                        <td class="checkRecore-content">&nbsp;</td>
                        <td class="checkRecore-label">&nbsp;</td>
                        <td class="checkRecore-content">&nbsp;</td>
                        <td class="checkRecore-label">&nbsp;</td>
                        <td class="checkRecore-content">&nbsp;</td>
                    </tr>
                    </thead>
                    <tbody>
                    <!-- <tr>
                        <td><input type="hidden" value="111111"></td>
                    </tr> -->
                    <tr>
                        <td class="checkRecore-label">查验柜号：</td>
                        <td class="checkRecore-content">
                            <div class='multi_select multi_select_cabinetNo'></div>
                        </td>
                        <td class="checkRecore-label">报关单号：</td>
                        <td class="checkRecore-content check-declaraNo"><!--IRSU2345600INIO--></td>
                        <td class="checkRecore-label">业务编号：</td>
                        <td class="checkRecore-content check-businessNo">BE201706160055</td>
                    </tr>
                    <tr>
                        <td class="checkRecore-label">查验单位：</td>
                        <td class="checkRecore-content">
                            <!-- <select name="" class="check-depts-select"> -->
                            <!-- <option value="">新港海关</option>
                            <option value="">澜石海关</option>
                            <option value="">高明南沙海关海关</option> -->
                            <!-- </select> -->
                            <div class='check-depts-select'></div>
                            <div class="checkDepts-input-container">
                                <input type="text" class="check-depts-input"/>
                            </div>

                        </td>
                        <td class="checkRecore-label">查验时间：</td>
                        <td class="checkRecore-content"><input type="text" class="datepicker"></td>
                        <td class="checkRecore-label">实际托运人：</td>
                        <td class="checkRecore-content check-reallyOwner">北京江洲国际贸易有限公司</td>
                    </tr>
                    <tr>
                        <td class="checkRecore-label">收发货人：</td>
                        <td class="checkRecore-content check-owner">北京江洲国际贸易有限公司</td>
                        <td class="checkRecore-label">查验商品：</td>
                        <td class="checkRecore-content">
                            <!-- <select name="" class="check-goods-select"> -->
                            <!-- <option value="jingang">金刚石抛釉磨块</option>
                            <option value="shuzhi">树脂聚合成料</option> -->
                            <!-- </select> -->
                            <div class='check-goods-select'></div>
                        </td>
                        <td class="checkRecore-label">查验项目：</td>
                        <td class="checkRecore-content">
                            <!-- <select name="" class="check-items-select"> -->
                            <!-- <option value="jingang">金刚石抛釉磨块</option>
                            <option value="shuzhi">树脂聚合成料</option> -->
                            <!-- </select> -->
                            <div class='check-items-select'></div>
                            <div class="checkItems-input-container">
                                <input type="text" class="check-items-input"/>
                            </div>
                        </td>
                    </tr>
                    </tbody>
                    <tfoot>
                    <!--<tr>
                        <td colspan="6">
                            <input type="radio" value="1"/>短信通知
                            <span>手机号：<input type="text" placeholder="默认手机"/></span>
                        </td>
                    </tr>-->
                    </tfoot>
                </table>
            </div>
            <div class="checkRecore-section checkRecore-section-contact">
                <!-- <table>
                    <thead>
                        <tr>
                            <td class="checkRecore-label label-bold">查验记录2</td>
                            <td class="checkRecore-content">&nbsp;</td>
                            <td class="checkRecore-label">&nbsp;</td>
                            <td class="checkRecore-content">&nbsp;</td>
                            <td class="checkRecore-label">&nbsp;</td>
                            <td class="checkRecore-content">&nbsp;</td>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                                                <td class="checkRecore-label">查验柜号：</td>
                                                <td class="checkRecore-content">
                                                    <div class='multi_select'></div>
                                                </td>
                                                <td class="checkRecore-label">报关单号：</td>
                                                <td class="checkRecore-content">IRSU2345600INIO</td>
                                                <td class="checkRecore-label">业务编号：</td>
                                                <td class="checkRecore-content">BE201706160055</td>
                                            </tr>
                                            <tr>
                                                <td class="checkRecore-label">查验单位：</td>
                                                <td class="checkRecore-content">
                                                    <select name="" id="">
                                                        <option value="">新港海关</option>
                                                        <option value="">澜石海关</option>
                                                        <option value="">高明南沙海关海关</option>
                                                    </select>
                                                </td>
                                                <td class="checkRecore-label">查验时间：</td>
                                                <td class="checkRecore-content"><input type="text" class="datepicker"></td>
                                                <td class="checkRecore-label">实际托运人：</td>
                                                <td class="checkRecore-content">北京江洲国际贸易有限公司</td>
                                            </tr>
                                            <tr>
                                                <td class="checkRecore-label">收发货人：</td>
                                                <td class="checkRecore-content">北京江洲国际贸易有限公司</td>
                                                <td class="checkRecore-label">查验商品：</td>
                                                <td class="checkRecore-content">
                                                    <select name="" id="">
                                                        <option value="jingang">金刚石抛釉磨块</option>
                                                        <option value="shuzhi">树脂聚合成料</option>
                                                    </select>
                                                </td>
                                                <td class="checkRecore-label">查验项目：</td>
                                                <td class="checkRecore-content">
                                                    <select name="" id="">
                                                        <option value="jingang">金刚石抛釉磨块</option>
                                                        <option value="shuzhi">树脂聚合成料</option>
                                                    </select>
                                                </td>
                                            </tr>
                    </tbody>
                    <tfoot>
                        <tr>
                            <td colspan="6">
                                <input type="radio" value="1"/>短信通知
                                <span>手机号：<input type="text" placeholder="默认手机"/></span>
                            </td>
                        </tr>
                    </tfoot>
                </table> -->
            </div>
            <div class="btn-section">
                <button type="button" class="btn btn-blue btn-back">返回</button>
                <button type="button" class="btn btn-blue btn-confirm">确认</button>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript" src="../assets/js/jquery.js"></script>
<script type="text/javascript" src="../assets/plugin/multiSelect/js/multiselect.js"></script>
<script type="text/javascript" src="../assets/plugin/jquery-ui-1.12.1.custom/jquery-ui.js"></script>
<script type="text/javascript" src="../assets/plugin/layer/layer.js"></script>
<script type="text/javascript" src="../assets/js/record.js"></script>
<script type="text/javascript">
    var did;
    $(document).ready(function () {
        __PROTOTYPE__._init();
        did = __PROTOTYPE__._getUrlSearch();
        did = did.substring(did.indexOf("=") + 1);
        $(".btn").click("on", function () {
            var recordsObj = {};
            recordsObj.records = [];
            if ($(this).hasClass("btn-confirm")) {
                recordsObj.records.push(__PROTOTYPE__._getFormParams(
                    $(".checkRecore-section-default")
                        .find("table:not(.checkRecord-table-template)")));
                $(".checkRecore-section-contact").find("div.contact-wrap").each(function (i, n) {
                    recordsObj.records.push(__PROTOTYPE__._getFormParams($(this)));
                });
                console.log(recordsObj.records);
                /*console.log(typeof(JSON.stringify(recordsObj.records)));
                 console.log(JSON.stringify(recordsObj.records));*/
                var temp = JSON.stringify(recordsObj.records);
                var submitParams = '{"records":' + temp + '}';
                console.log(submitParams);
                $.ajax({
                           /*url:'../assets/js/testData/response.js',*/
                           url: '/api/verify/initRecord',
                           type: 'post',
                           data: "records=" + submitParams,
                           /*data: {"records": JSON.stringify(recordsObj.records)},*/
                           dataType: 'json',
                           beforeSend: function () {
                               for (var i = 0; i < recordsObj.records.length; i++) {
                                   if (recordsObj.records[i].contaList.length == 1
                                       && recordsObj.records[i].contaList[0] == "") {
                                       layer.alert("查验柜号不能为空");
                                       return false;
                                       break;
                                   }
                                   if (!recordsObj.records[i].ctime) {
                                       layer.alert("查验时间不能为空");
                                       return false;
                                       break;
                                   }
                                   if (recordsObj.records[i].itemList.length == 0) {
                                       layer.alert("查验项目不能为空");
                                       return false;
                                       break;
                                   }
                                   if (recordsObj.records[i].deptList.length == 0) {
                                       layer.alert("查验单位不能为空");
                                       return false;
                                       break;
                                   }
                                   if (recordsObj.records[i].goodsList.length == 0) {
                                       layer.alert("查验商品不能为空");
                                       return false;
                                       break;
                                   }
                                   if (!recordsObj.records[i].otherDepts
                                       && recordsObj.records[i].otherDepts == "") {
                                       layer.alert("查验单位选择其他的原因不能为空");
                                       return false;
                                       break;
                                   }
                                   if (!recordsObj.records[i].otherItems
                                       && recordsObj.records[i].otherItems == "") {
                                       layer.alert("查验项目选择其他的原因不能为空");
                                       return false;
                                       break;
                                   }
                               }
                           },
                           success: function (data) {
                               if (data.error_code == 0) {
                                   alert("提交成功");
                                   window.location.href = "/business/validMain";
                               } else {
                                   alert("系统内部错误");
                               }
                               console.log(data);
                           },
                           error: function (a, b, c) {
                               console.log(b);
                           }
                       });
            } else {
                history.go(-1);
            }
        });
        if (window.screen.width == 1366) {
            $(".cabinet-name").css("width", "24%");
            $(".cabinet-link").css("width", "76%");
        }
        $(window).on("unload", function (e) {
            if (did) {
                $.ajax({
                           url: '/datalock/onUnlock.do?opaId=VDBS&bidId=' + did,
                           async: false
                       });
            }
        });
    });

    window.onbeforeunload = function (e) {
        if (did) {
            $.ajax({
                       url: '/datalock/onUnlock.do?opaId=VDBS&bidId=' + did,
                       async: false
                   });
        }
    };
</script>


</body>
</html>
